bitkeeper revision 1.969 (40d06e5bLmMtClRlYKKJQZd2RPCAyw)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 16 Jun 2004 15:59:23 +0000 (15:59 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 16 Jun 2004 15:59:23 +0000 (15:59 +0000)
Allow privileged build to be used in non-priv domain without crashing.

.rootkeys
BitKeeper/etc/ignore
linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/frontend/main.c
linux-2.4.26-xen-sparse/arch/xen/drivers/netif/frontend/main.c
linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c
linux-2.4.26-xen-sparse/arch/xen/vmlinux.lds
linux-2.4.26-xen-sparse/include/asm-xen/io.h
linux-2.4.26-xen-sparse/include/asm-xen/module.h [new file with mode: 0644]
linux-2.4.26-xen-sparse/mkbuildtree

index 1308fd3755addf6f66722f4bb81273aa4bf78380..61bbff8259eb391508f6ad5700b2dcfb079e20b3 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 3e5a4e673p7PEOyHFm3nHkYX6HQYBg linux-2.4.26-xen-sparse/include/asm-xen/irq.h
 3ead095db_LRUXnxaqs0dA1DWhPoQQ linux-2.4.26-xen-sparse/include/asm-xen/keyboard.h
 3e5a4e678ddsQOpbSiRdy1GRcDc9WA linux-2.4.26-xen-sparse/include/asm-xen/mmu_context.h
+40d06e5b2YWInUX1Xv9amVANwd_2Xg linux-2.4.26-xen-sparse/include/asm-xen/module.h
 3f8707e7ZmZ6TxyX0ZUEfvhA2Pb_xQ linux-2.4.26-xen-sparse/include/asm-xen/msr.h
 3e7270deQqtGPSnFxcW4AvJZuTUWfg linux-2.4.26-xen-sparse/include/asm-xen/multicall.h
 3e5a4e67mnQfh-R8KcQCaVo2Oho6yg linux-2.4.26-xen-sparse/include/asm-xen/page.h
index 7f5d7578d3401a75a411cab5f11aa389066f6f5c..51b5f03492f30bbf5fa400ecd2521cf964b92723 100644 (file)
@@ -3,6 +3,7 @@
 *.pyc
 *.so
 *.so.*
+*.tar.gz
 *~
 BitKeeper/*/*
 PENDING/*
@@ -10,8 +11,6 @@ TAGS
 extras/mini-os/h/hypervisor-ifs
 install
 install/*
-linux-*-xen/*
-linux-*.tar.gz
 linux-2.4.26-xen/*
 linux-xen-sparse
 tools/*/build/lib*/*.py
@@ -20,7 +19,6 @@ tools/misc/miniterm/miniterm
 tools/misc/xen_cpuperf
 tools/misc/xen_log
 tools/misc/xen_read_console
-tools/xend-2004-06-10_1309.tgz
 tools/xentrace/xentrace
 xen/drivers/pci/classlist.h
 xen/drivers/pci/devlist.h
index 1ecb766ade104de047496daed732b448d8eced7e..fa662496ec876f8c48edc38ab33cac670407eb89 100644 (file)
@@ -799,13 +799,9 @@ module_exit(xlblk_cleanup);
 
 void blkdev_suspend(void)
 {
-    /* XXX FIXME */
-    BUG();
 }
 
 
 void blkdev_resume(void)
 {
-    /* XXX FIXME */
-    BUG();
 }
index 3481788bf74293d5c7a68ad339f71c792660780a..25bad4b5767b003d53290260fdcd1c92c0e0326c 100644 (file)
@@ -100,7 +100,6 @@ static struct net_device *find_dev_by_handle(unsigned int handle)
 }
 
 #define MULTIVIF
-//#ifdef MULTIVIF
 
 /** Network interface info. */
 struct netif_ctrl {
@@ -112,10 +111,11 @@ struct netif_ctrl {
     int err;
 };
 
-static struct netif_ctrl netctrl = {};
+static struct netif_ctrl netctrl;
 
-static void netctrl_init(void){
-    netctrl = (struct netif_ctrl){};
+static void netctrl_init(void)
+{
+    memset(&netctrl, 0, sizeof(netctrl));
     netctrl.interface_n = -1;
 }
 
@@ -164,8 +164,6 @@ static int netctrl_connected_count(void)
     return connected;
 }
 
-//#endif
-
 static int network_open(struct net_device *dev)
 {
     struct net_private *np = dev->priv;
@@ -636,12 +634,12 @@ static void netif_status_change(netif_fe_interface_status_changed_t *status)
     struct net_device *dev;
     struct net_private *np;
     
-//#ifdef MULTIVIF
-    if(netctrl.interface_n <= 0){
+    if ( netctrl.interface_n <= 0 )
+    {
         printk(KERN_WARNING "Status change: no interfaces\n");
         return;
     }
-//#endif
+
     dev = find_dev_by_handle(status->handle);
     if(!dev){
         printk(KERN_WARNING "Status change: invalid netif handle %u\n",
@@ -790,11 +788,12 @@ static int create_netdev(int handle, struct net_device **val){
     return err;
 }
 
-//#ifdef MULTIVIF
-/** Initialize the network control interface. Set the number of network devices
+/*
+ * Initialize the network control interface. Set the number of network devices
  * and create them.
  */
-static void netif_driver_status_change(netif_fe_driver_status_changed_t *status)
+static void netif_driver_status_change(
+    netif_fe_driver_status_changed_t *status)
 {
     int err = 0;
     int i;
@@ -810,12 +809,11 @@ static void netif_driver_status_change(netif_fe_driver_status_changed_t *status)
         }
     }
 }
-//#endif
-
 
 static void netif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
 {
     int respond = 1;
+
     switch ( msg->subtype )
     {
     case CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED:
@@ -824,24 +822,24 @@ static void netif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
         netif_status_change((netif_fe_interface_status_changed_t *)
                             &msg->msg[0]);
         break;
-//#ifdef MULTIVIF
+
     case CMSG_NETIF_FE_DRIVER_STATUS_CHANGED:
         if ( msg->length != sizeof(netif_fe_driver_status_changed_t) )
             goto error;
         netif_driver_status_change((netif_fe_driver_status_changed_t *)
                                    &msg->msg[0]);
-        // Message is a response, so do not respond.
+        /* Message is a response */
         respond = 0;
         break;
-//#endif
-      error:
+
+    error:
     default:
         msg->length = 0;
         break;
     }
-    if(respond){
+
+    if ( respond )
         ctrl_if_send_response(msg);
-    }
 }
 
 
@@ -880,15 +878,11 @@ static int __init init_module(void)
 
 #ifdef MULTIVIF
     /* Wait for all interfaces to be connected. */
-    for(wait_i = 0; 1; wait_i++) {
-        if(wait_i < wait_n){
-            err = netctrl_connected();
-        } else {
-            err = -ENETDOWN;
-        }
-        if(err < 0) goto exit;
-        if(err > 0){
-            err = 0;
+    for ( wait_i = 0; ; wait_i++)
+    {
+        if ( (err = (wait_i < wait_n) ? netctrl_connected() : -ENETDOWN) != 0 )
+        {
+            err = (err > 0) ? 0 : err;
             break;
         }
         set_current_state(TASK_INTERRUPTIBLE);
@@ -896,8 +890,9 @@ static int __init init_module(void)
      }
 #endif
 
- exit:
-    if(err) cleanup_module();
+    if ( err )
+        ctrl_if_unregister_receiver(CMSG_NETIF_FE, netif_ctrlif_rx);
+
     return err;
 }
 
index a787a5c78c9e3d4aca54e22d2f203bf26d357365..ccdf3e266d20d8ff4c14cf249672493a79a281e9 100644 (file)
@@ -162,6 +162,36 @@ static void __init parse_mem_cmdline (char ** cmdline_p)
     *cmdline_p = command_line;
 }
 
+/*
+ * Every exception-fixup table is sorted (i.e., kernel main table, and every
+ * module table. Some elements may be out of order if they reference text.init,
+ * for example. 
+ */
+static void sort_exception_table(struct exception_table_entry *start,
+                                 struct exception_table_entry *end)
+{
+    struct exception_table_entry *p, *q, tmp;
+
+    for ( p = start; p < end; p++ )
+    {
+        for ( q = p-1; q > start; q-- )
+            if ( p->insn > q->insn )
+                break;
+        if ( ++q != p )
+        {
+            tmp = *p;
+            memmove(q+1, q, (p-q)*sizeof(*p));
+            *q = tmp;
+        }
+    }
+}
+
+int xen_module_init(struct module *mod)
+{
+    sort_exception_table(mod->ex_table_start, mod->ex_table_end);
+    return 0;
+}
+
 void __init setup_arch(char **cmdline_p)
 {
     unsigned long bootmap_size, start_pfn, max_low_pfn;
@@ -172,11 +202,17 @@ void __init setup_arch(char **cmdline_p)
     extern unsigned long cpu0_pte_quicklist[];
     extern unsigned long cpu0_pgd_quicklist[];
 
+    extern const struct exception_table_entry __start___ex_table[];
+    extern const struct exception_table_entry __stop___ex_table[];
+
     /* Force a quick death if the kernel panics. */
     extern int panic_timeout;
     if ( panic_timeout == 0 )
         panic_timeout = 1;
 
+    /* Ensure that the kernel exception-fixup table is sorted. */
+    sort_exception_table(__start___ex_table, __stop___ex_table);
+
 #ifndef CONFIG_HIGHIO
     blk_nohighio = 1;
 #endif
index 7c4c4f8e9c70a6835dc6e766eeae2ddf09cd15e0..6bd3ec3c04894119d1354b8aaabd4da5b49fefc1 100644 (file)
@@ -64,13 +64,6 @@ SECTIONS
        }
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-       *(.text.exit)
-       *(.data.exit)
-       *(.exitcall.exit)
-       }
-
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
index 5ab5fe9bfcfbf7f336ac5efd39ecc387b770474f..469c6ec09c1683d044e893c3edd0b1121f52aac5 100644 (file)
@@ -309,8 +309,15 @@ static inline void flush_write_buffers(void)
 
 #ifdef SLOW_IO_BY_JUMPING
 #define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:"
-#else
+#elif defined(__UNSAFE_IO__)
 #define __SLOW_DOWN_IO "\noutb %%al,$0x80"
+#else
+#define __SLOW_DOWN_IO "\n1: outb %%al,$0x80\n"           \
+                       "2:\n"                             \
+                       ".section __ex_table,\"a\"\n\t"    \
+                       ".align 4\n\t"                     \
+                       ".long 1b,2b\n"                    \
+                       ".previous"
 #endif
 
 #ifdef REALLY_SLOW_IO
@@ -329,8 +336,18 @@ extern void *xquad_portio;    /* Where the IO area was mapped */
 #define __OUT1(s,x) \
 static inline void out##s(unsigned x value, unsigned short port) {
 
+#ifdef __UNSAFE_IO__
 #define __OUT2(s,s1,s2) \
 __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
+#else
+#define __OUT2(s,s1,s2)                                  \
+__asm__ __volatile__ ("1: out" #s " %" s1 "0,%" s2 "1\n" \
+                      "2:\n"                             \
+                      ".section __ex_table,\"a\"\n\t"    \
+                      ".align 4\n\t"                     \
+                      ".long 1b,2b\n"                    \
+                      ".previous"
+#endif
 
 #if defined (CONFIG_MULTIQUAD) && !defined(STANDALONE)
 #define __OUTQ(s,ss,x)    /* Do the equivalent of the portio op on quads */ \
@@ -378,8 +395,22 @@ __OUTQ(s,s##_p,x)
 #define __IN1(s) \
 static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
 
+#ifdef __UNSAFE_IO__
 #define __IN2(s,s1,s2) \
 __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
+#else
+#define __IN2(s,s1,s2) \
+__asm__ __volatile__ ("1: in" #s " %" s2 "1,%" s1 "0\n" \
+                      "2:\n"                            \
+                      ".section .fixup,\"ax\"\n"        \
+                      "3: mov" #s " $~0,%" s1 "0\n\t"   \
+                      "jmp 2b\n"                        \
+                      ".previous\n"                     \
+                      ".section __ex_table,\"a\"\n\t"   \
+                      ".align 4\n\t"                    \
+                      ".long 1b,3b\n"                   \
+                      ".previous"
+#endif
 
 #if !defined(CONFIG_MULTIQUAD) || defined(STANDALONE)
 #define __IN(s,s1,i...) \
diff --git a/linux-2.4.26-xen-sparse/include/asm-xen/module.h b/linux-2.4.26-xen-sparse/include/asm-xen/module.h
new file mode 100644 (file)
index 0000000..17cd5ff
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _ASM_I386_MODULE_H
+#define _ASM_I386_MODULE_H
+/*
+ * This file contains the i386 architecture specific module code.
+ */
+
+extern int xen_module_init(struct module *mod);
+
+#define module_map(x)          vmalloc(x)
+#define module_unmap(x)                vfree(x)
+#define module_arch_init(x)    xen_module_init(x)
+#define arch_init_modules(x)   do { } while (0)
+
+#endif /* _ASM_I386_MODULE_H */
index 2e9f7b992099df0c10ab6500dcb26d3247da7366..8d0009da038f7c3c298583fde8f9f6d003793b04 100755 (executable)
@@ -156,7 +156,6 @@ ln -sf ../asm-i386/mca_dma.h
 ln -sf ../asm-i386/mman.h 
 ln -sf ../asm-i386/mmu.h 
 ln -sf ../asm-i386/mmx.h 
-ln -sf ../asm-i386/module.h 
 ln -sf ../asm-i386/mpspec.h 
 ln -sf ../asm-i386/msgbuf.h 
 ln -sf ../asm-i386/mtrr.h